package com.yingdong.logic.service;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;

import com.yingdong.annotation.AutoInvoke;
import com.yingdong.excel.Item;

@Service
public class ItemService {
	static Log logger = LogFactory.getLog(ItemService.class);
	private static Map<Integer, Item> itemMap = new HashMap<>();

	@AutoInvoke
	public static void init() {
		for (Item item : Item.data) {
			itemMap.put(item.getId(), item);
		}
		logger.info("ItemService加载完毕");
	}

	public static Item getItemById(int itemId) {
		return itemMap.get(itemId);
	}
}
